<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <title>申请采购单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <link rel="stylesheet" th:href="@{/css/font.css}"/>
    <link rel="stylesheet" th:href="@{/css/xadmin.css}"/>

    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>

    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
    <span class="layui-breadcrumb">
    <a href="">首页</a>
    <a href="">采购管理</a>
    <a><cite>申请采购单</cite></a>
    </span><a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新"><i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <form id="addForm" class="layui-form" th:action="@{/procurement/producer}" method="get">

                    <input type="hidden" name="procurement_id" th:value="${procurement.id}" />
                    <div class="layui-form-item">
                        <label for="producer" class="layui-form-label">
                            <span class="x-red">*</span>供应商
                        </label>
                        <div class="layui-input-inline">
                            <select name="producer" lay-filter="province" id="producer">
                                <option value="0">请选择供应商</option>
                                <option th:each="item1: ${producerNameList}" th:value="${item1.id}" th:text="${item1.name}"></option>
                            </select>
                        </div>
                        <button  class="layui-btn" lay-filter="add" lay-submit="">
                            确定
                        </button>
                    </div>

                    <!--                    <div class="layui-form-item">-->
                    <!--                        <label class="layui-form-label">-->
                    <!--                        </label>-->
                    <!--                        -->
                    <!--                    </div>-->
                </form>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th style="display: none;">ID</th>
                            <th>商品名称</th>
                            <th>单价</th>
                            <th>产地</th>
                            <th>生产日期</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        <tr th:each="item,itemStat : ${items}">
                            <td th:text="${item.id}" style="display: none;"></td>
                            <td th:text="${item.name}"></td>
                            <td th:text="${item.price}"></td>
                            <td th:text="${item.place}"></td>
                            <td th:text="${#dates.format(item.date,'yyyy-MM-dd')}"></td>
                            <td class="td-manage">
                                <button class="layui-btn layui-btn layui-btn-xs"  th:onclick="'xadmin.open(\'加入\',\'/procurement/to/number/'+${item.id}+'/'+${procurement.id}+'\')'" sec:authorize="hasRole('PROCUREMENT_CREATE')"><i class="layui-icon">&#xe642;</i>加入</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item" style="float: right;padding-right: 15px;">
                    <label class="layui-form-label">
                    </label>
                    <button  class="layui-btn" onclick="changeSH()" lay-filter="add" lay-submit="">确定
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>

    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });


    function changeSH() {
        //关闭当前frame
        xadmin.close();
        // 可以对父窗口进行刷新
        xadmin.father_reload();
    }
</script>

</html>